package importantDevice

import (
	"gorm.io/plugin/soft_delete"
	"xkginweb/global"
)

// 重要设备表

type QccImportantDevice struct {
	ImportantDeviceId uint                  `gorm:"primarykey;comment:主键ID" json:"important_device_id"`
	CreatedAt         global.LocalTime      `gorm:"type:datetime;comment:创建时间" json:"created_at"`
	UpdatedAt         global.LocalTime      `gorm:"type:datetime;comment:更新时间" json:"updated_at"`
	IsDeleted         soft_delete.DeletedAt `gorm:"type:bigint(20) unsigned;default:0;comment:是否删除" json:"is_deleted"`
	DeviceName        string                `gorm:"type:varchar(50);default:'';comment:设备名;NOT NULL" json:"device_name"`
	RoomId            uint                  `gorm:"type:bigint(20);comment:房间id;NOT NULL" json:"room_id"`
	QccRoom           *QccRoom              `gorm:"foreignKey:RoomId;references:room_id;" json:"room"`
	Type              string                `json:"type" gorm:"not null;default:'';comment:检查类型"`
}

func (QccImportantDevice) TableName() string {
	return "qcc_important_device"
}

type QccImportantDeviceList struct {
	ImportantDeviceId uint   `gorm:"primarykey;comment:主键ID" json:"important_device_id"`
	DeviceName        string `gorm:"type:varchar(50);default:'';comment:设备名;NOT NULL" json:"device_name"`
	RoomId            uint   `gorm:"type:bigint(20);comment:房间id;NOT NULL" json:"room_id"`
	Type              string `json:"type" gorm:"not null;default:'';comment:检查类型"`
}

type QccRoom struct {
	RoomId   uint   `json:"room_id" gorm:"primarykey;comment:主键ID"` // 主键ID
	RoomName string `json:"room_name" gorm:"not null;default:'';comment:房间名"`
	RoomType int8   `json:"room_type" gorm:"not null;default:0;comment:房间类型 1进线房 2机房"`
}
